﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace eFatura
{
    public partial class XPopupForm : XForm
    {
        public XPopupForm()
        {
            InitializeComponent();

            this.KeyPreview = true;
            if (!CancelESC)
                this.KeyDown += new KeyEventHandler(XPopupForm_KeyDown);

            FooterBar.Visible = false;
        }

        public string FooterText
        {
            set
            {
                FooterLabel.Caption = value;
                FooterLabel.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
                FooterBar.Visible = true;
            }
        }

        private bool cancelESC = false;
        public bool CancelESC
        {
            get
            {
                return cancelESC;
            }
            set
            {
                cancelESC = true;
            }
        }

        void XPopupForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                this.Close();
            }
        }
    }
}